home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-30 | 6.4 KB | 245 lines | [TEXT/KAHL] |
- Contents:
-
- -----------------------------------------
- AEUtilities.c: some useful routines…
- AEUtilities.h: the corresponding include
- -----------------------------------------
-
- OSErr GetTargetID(…) : returns the targetID of an application
- OSErr EntityPathToAlias(…) : converts a full path name into an alias
- OSErr GetProcessPSN(…) : return the PSN of the specified application
- OSErr KillProcess(…) : Kill an application
-
-
- ----------------------------------------------------------
- CGenericAE.c: the base class for building an apple event
- CGenericAE.h: the corresponding include
- ----------------------------------------------------------
-
- // to create the class simply issue
- CGenericAE *LcCAE = new(CGenericAE) ;
-
- // then you can either select a target using the PPCBrower()
- // (note that you must specified how you want the target to be
- // identified (PSN, TargetID, FileType and Creator, etc.):
- LcOSErr = LcCAE->AskAndBuildTarget(sPSN) ;
-
- // or directly specified the target.
- // For example:
- LcOSErr = LcCAE->BuildTargetWithTypeAndSign(TheProcessType,
- TheProcessSignature);
-
- // Once the target is valid, you build the event you want to send with:
- LcOSErr = LcCAE->CreateAE(kCoreEventClass,kAEQuitApplication) ;
-
- // then you send the event (and here ask for a reply):
- LcOSErr = LcCAE->SendAEWithReply() ;
-
-
- ---------------------------------------------------------------
- CFinderEvent.c: the FinderEvent class (derived from CGenericAE)
- CFinderEvent.h: the corresponding include
- ---------------------------------------------------------------
-
- // To create the class simply issue:
- CFinderEvent *LcFinderEvent = new(CFinderEvent) ;
-
- // To intialise it, you can either call (for your local finder):
- LcOSErr = LcFinderEvent->IFinderEvent() ;
-
- // or (TheRemoteMachine can be NULL):
- LcOSErr = LcFinderEvent->IRemoteFinderEvent(TheRemoteMachine)
-
- // then simply choose the event you want to send (see below).
- // The following call display the finder about box:
- LcFinderEvent->FESendAbout(void)
-
-
- The possible calls are:
- =======================
-
- /*
- * Displays the finder about dialog box
- */
- OSErr CFinderEvent::FESendAbout(void)
-
- /*
- * Creates an alias of the specified item(s) in the specified folder
- * (you can pass a list of files separated by a comma).
- */
- OSErr CFinderEvent::FESendAliasSelection(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Closes the finder about dialog box
- */
- OSErr CFinderEvent::FESendCloseAbout(void)
-
- /*
- * Closes the specified window, which can be a Folder window (kAEMain),
- * a GetInfo window (kAEInfo), or a Sharing window (kAESharing).
- */
- OSErr CFinderEvent::FESendCloseWindow(
- Ptr TheWindowPath,
- WindowType TheWindowType)
-
- /*
- * Copies one or more files (separated by a comma). The Position (HPos,VPos)
- * is the position in the folder!!! (I generally always choose (1,1))
- */
- OSErr CFinderEvent::FESendDragSelection(
- Ptr TheDestinationFolder,
- Ptr TheItemPathList,
- short TheHPos,
- short TheVPos)
-
- /*
- * Duplicates one or more files (separated by a comma).
- */
- OSErr CFinderEvent::FESendDuplicateSelection(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Empties the trash can.
- */
- OSErr CFinderEvent::FESendEmptyTrash(void)
-
- /*
- * Displays the GetInfo window of the specified items. To get info on a
- * disk, TheFolderPath must be empty, and TheItemList must contain the
- * disk's name with a colon at its end.
- */
- OSErr CFinderEvent::FESendGetInfo(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Closes the clipboard window.
- */
- OSErr CFinderEvent::FESendHideClipboard(void)
-
- /*
- * Drags one or more files (separated by a comma). The Position (HPos,VPos)
- * is the position in the folder!!! (I generally always choose (1,1))
- */
- OSErr CFinderEvent::FESendMoveSelection(
- Ptr TheDestinationFolder,
- Ptr TheItemPathList,
- short TheHPos,
- short TheVPos)
-
- /*
- * Sets the top left corner of the specified window to the specified point.
- */
- OSErr CFinderEvent::FESendMoveWindow(
- Ptr TheWindowPath,
- short TheHPos,
- short TheVPos)
-
- /*
- * Opens (launches) one or more files (separated by a comma)
- * in the specified folder.
- *
- * You can open remote files if you used the IRemoteFinderEvent() call.
- */
- OSErr CFinderEvent::FESendOpenSelection(
- Ptr TheFolderPath,
- Ptr TheItemList)
- {
- RETURN(CreateAE(kAEFinderEvents,kAEOpenSelection)) ;
- RETURN(protFolderPathPutParam(TheFolderPath)) ;
- RETURN(protFilesListPutParam(TheFolderPath,TheItemList)) ;
- return(SendAE(kAENeverInteract | kAENoReply)) ;
- }
-
- /*
- * Brings the Page Setup dialo box.
- */
- OSErr CFinderEvent::FESendPageSetup(
- Ptr TheWindowPath)
-
- /*
- * Prints the specified file(s).
- *
- * You can print remote files if you used the IRemoteFinderEvent() call.
- */
- OSErr CFinderEvent::FESendPrintSelection(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Prints the current view of the specified window
- */
- OSErr CFinderEvent::FESendPrintWindow(
- Ptr TheWindowPath)
-
- /*
- * Brings the specified item(s) back to their original folder(s). The
- * items must be either on the desktop or in the trask.
- */
- OSErr CFinderEvent::FESendPutAway(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Sets the size of the specified window to the specified values.
- */
- OSErr CFinderEvent::FESendResizeWindow(
- Ptr TheWindowPath,
- short TheHeight,
- short TheWidth)
-
- /*
- * Restarts the machine.
- */
- OSErr CFinderEvent::FESendRestart(void)
-
- /*
- * Opens the specified window (TheFolderPath) and selects and hilites the
- * specified item(s).
- */
- OSErr CFinderEvent::FESendRevealSelection(
- Ptr TheFolderPath,
- Ptr TheItemList)
-
- /*
- * Changes the way the items are viewed in the specified window (by small
- * icon, by icon, by name, etc., see TypeWindowView in AERegistry.h).
- */
- OSErr CFinderEvent::FESendSetView(
- Ptr TheWindowPath,
- TypeWindowView TheWindowView)
-
- /*
- * Brings the Sharing dialog bow for the specified appl, disks or folders.
- */
- OSErr CFinderEvent::FESendSharing(
- Ptr TheParentPath,
- Ptr TheFolderList)
-
- /*
- * Displays the Clipboard window.
- */
- OSErr CFinderEvent::FESendShowClipboard(void)
-
- /*
- * Shuts down the machine.
- */
- OSErr CFinderEvent::FESendShutDown(void)
-
- /*
- * Puts the machine to sleep (assuming it is possible of course).
- */
- OSErr CFinderEvent::FESendSleep(void)
-
- /*
- * Zooms the window to the specified state (zoomIn or zoomOut).
- */
- OSErr CFinderEvent::FESendZoomWindow(
- Ptr TheWindowPath,
- TypeWindowZoom TheWindowZoom)
-
-
- That's all folks!